package com.itheima.advantagesup.context;

/**
 * @author Du leilei
 */
// 封装 ThreadLocal 操作的工具类，实现线程内数据共享
public class BaseContext {
    public static ThreadLocal<Object> threadLocal = new ThreadLocal<>();


    /**
     * 设置值
     * @param id
     */
    public static void setCurrentId(Object id) {
        threadLocal.set(id);
    }

    /**
     * 获取值
     * @return
     */
    public static Object getCurrentId() {
        return threadLocal.get();
    }

    /**
     * 清除值
     */
    public static void removeCurrentId() {
        threadLocal.remove();
    }
}
